// ==========================================================================
// GFast自动生成model操作代码。
// 生成日期：2024-06-18 17:14:29
// 生成路径: internal/app/app/model/app_news.go
// 生成人：gfast
// desc:文章
// company:云南奇讯科技有限公司
// ==========================================================================

package model

import (
	"github.com/gogf/gf/v2/os/gtime"
	"github.com/gogf/gf/v2/util/gmeta"
	comModel "github.com/tiger1103/gfast/v3/internal/app/common/model"
)

// AppNewsInfoRes is the golang structure for table app_news.
type AppNewsInfoRes struct {
	gmeta.Meta       `orm:"table:app_news"`
	Id               uint64                        `orm:"id,primary" json:"id" dc:"ID"`          // ID
	Title            string                        `orm:"title" json:"title" dc:"标题"`            // 标题
	Content          string                        `orm:"content" json:"content" dc:"内容"`        // 内容
	CategoryId       uint                          `orm:"category_id" json:"categoryId" dc:"分类"` // 分类
	LinkedCategoryId *LinkedAppNewsAppNewsCategory `orm:"with:id=category_id" json:"linkedCategoryId"`
	Author           string                        `orm:"author" json:"author" dc:"作者"`          // 作者
	Thumb            string                        `orm:"thumb" json:"thumb" dc:"缩略图"`           // 缩略图
	Status           int                           `orm:"status" json:"status" dc:"状态"`          // 状态
	Hits             uint                          `orm:"hits" json:"hits" dc:"点击数"`             // 点击数
	CreatedAt        *gtime.Time                   `orm:"created_at" json:"createdAt" dc:"创建日期"` // 创建日期
	UpdatedAt        *gtime.Time                   `orm:"updated_at" json:"updatedAt" dc:"更新日期"` // 更新日期
	DeletedAt        *gtime.Time                   `orm:"deleted_at" json:"deletedAt" dc:"删除日期"` // 删除日期
}
type LinkedAppNewsAppNewsCategory struct {
	gmeta.Meta `orm:"table:app_news_category"`
	Id         uint   `orm:"id" json:"id" dc:"ID"`              // ID
	CateName   string `orm:"cate_name" json:"cateName" dc:"名称"` // 名称
	Pid        uint   `orm:"pid" json:"pid"`
}

type AppNewsListRes struct {
	Id               uint64                        `json:"id" dc:"ID"`
	Title            string                        `json:"title" dc:"标题"`
	CategoryId       uint                          `json:"categoryId" dc:"分类"`
	LinkedCategoryId *LinkedAppNewsAppNewsCategory `orm:"with:id=category_id" json:"linkedCategoryId" dc:"分类"`
	Author           string                        `json:"author" dc:"作者"`
	Thumb            string                        `json:"thumb" dc:"缩略图"`
	Status           int                           `json:"status" dc:"状态"`
	Hits             uint                          `json:"hits" dc:"点击数"`
	CreatedAt        *gtime.Time                   `json:"createdAt" dc:"创建日期"`
}

// AppNewsSearchReq 分页请求参数
type AppNewsSearchReq struct {
	comModel.PageReq
	Title      string `p:"title" dc:"标题"`                                    //标题
	CategoryId string `p:"categoryId" v:"categoryId@integer#分类需为整数" dc:"分类"` //分类
	Author     string `p:"author" dc:"作者"`                                   //作者
	Status     string `p:"status" v:"status@integer#状态需为整数" dc:"状态"`         //状态
}

// AppNewsSearchRes 列表返回结果
type AppNewsSearchRes struct {
	comModel.ListRes
	List []*AppNewsListRes `json:"list"`
}

// 相关连表查询数据
type LinkedAppNewsDataSearchRes struct {
	LinkedAppNewsAppNewsCategory []*LinkedAppNewsAppNewsCategory `json:"linkedAppNewsAppNewsCategory"`
}

// AppNewsAddReq 添加操作请求参数
type AppNewsAddReq struct {
	Title      string `p:"title"  dc:"标题"`
	Content    string `p:"content"  dc:"内容"`
	CategoryId uint   `p:"categoryId"  dc:"分类"`
	Author     string `p:"author"  dc:"作者"`
	Thumb      string `p:"thumb"  dc:"缩略图"`
	Status     int    `p:"status"  dc:"状态"`
	Hits       uint   `p:"hits"  dc:"点击数"`
}

// AppNewsEditReq 修改操作请求参数
type AppNewsEditReq struct {
	Id         uint64 `p:"id" v:"required#主键ID不能为空" dc:"ID"`
	Title      string `p:"title"  dc:"标题"`
	Content    string `p:"content"  dc:"内容"`
	CategoryId uint   `p:"categoryId"  dc:"分类"`
	Author     string `p:"author"  dc:"作者"`
	Thumb      string `p:"thumb"  dc:"缩略图"`
	Status     int    `p:"status"  dc:"状态"`
	Hits       uint   `p:"hits"  dc:"点击数"`
}
